package com.yz.server;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class Server {
    public static final Map<Socket, String> onlineSockets = new HashMap<>();
    public static void main(String[] args) {
        System.out.println("服务端系统启动了");
        try {
            ServerSocket serverSocket = new ServerSocket(Constant.PORT);
            while (true){
                System.out.println("等待客户端连接...");
                Socket socket = serverSocket.accept();
                new ServerReaderThread(socket).start();
                System.out.println("客户端连接了");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            System.out.println("服务端系统关闭了");
        }
    }
}
